﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace OrderAggregator.Core
{
    /// <summary>
    /// Конфиг агрегатора
    /// </summary>
    public struct AggregatorConfig
    {
        
        /// <summary>
        /// Входной каталог
        /// </summary>
        public string InputFolder;

        /// <summary>
        /// Выходной каталог
        /// </summary>
        public string OutputFolder;


        
        /// <summary>
        /// Load
        /// </summary>
        /// <param name="configFilePath"></param>
        public void Load(string configFilePath)
        {
            var document = new XmlDocument();
            document.Load(configFilePath);
            Load(document.DocumentElement);
        }

        /// <summary>
        /// Load
        /// </summary>
        /// <param name="configTag"></param>
        public void Load(XmlElement configTag)
        {
            if (configTag == null)
            {
                return;
            }

            var inputFolderTag = configTag.GetElementsByTagName("InputFolder")[0];
            InputFolder = inputFolderTag.InnerText.Trim();

            var outputFolderTag = configTag.GetElementsByTagName("OutputFolder")[0];
            OutputFolder = outputFolderTag.InnerText.Trim();
        }

        /// <summary>
        /// RU RuCulture
        /// </summary>
        public static readonly System.Globalization.CultureInfo RuCulture =
            System.Globalization.CultureInfo.GetCultureInfo("ru-RU");
        
    }
}
